package com.theme.common.third.weather;

public class WeatherUtils {
    /**
     * 风速转换成等级
     * @param windSpeed
     * @return
     */
    public static String windSpeedToScale(int windSpeed){
        String scale = "";

        if(windSpeed <= 1){
            scale = "0级";
        }else if(windSpeed > 1 && windSpeed <= 5){
            scale = "1级";
        }else if(windSpeed > 5 && windSpeed <= 11){
            scale = "2级";
        }else if(windSpeed > 11 && windSpeed <= 19){
            scale = "3级";
        }else if(windSpeed > 19 && windSpeed<= 28){
            scale = "4级";
        }else if(windSpeed > 28 && windSpeed<= 38){
            scale = "5级";
        }else if(windSpeed > 38 && windSpeed<= 49){
            scale = "6级";
        }else if(windSpeed > 49 && windSpeed<= 61){
            scale = "7级";
        }else if(windSpeed > 61 && windSpeed<= 74){
            scale = "8级";
        }else if(windSpeed > 74 && windSpeed<= 88){
            scale = "9级";
        }else if(windSpeed > 88 && windSpeed<= 102){
            scale = "10级";
        }else if(windSpeed > 102 && windSpeed<= 117){
            scale = "11级";
        }else if(windSpeed > 117 && windSpeed<= 133){
            scale = "12级";
        }
        return  scale;
    }

    /**
     * 天气类型转成字符串
     */
    public static String weatherTypeToString(String conditionCode){
        //conditionCode转为首字母小写
        conditionCode = conditionCode.substring(0,1).toLowerCase() + conditionCode.substring(1);
        String codeName = "晴";
        switch (conditionCode) {
            case "blowingDust":
                codeName = "扬沙";
                break;
            case "mostlyClear":
            case "clear":
                codeName = "晴";
                break;
            case "foggy":
                codeName = "雾";
                break;
            case "haze":
                codeName = "霾";
                break;
            case "mostlyCloudy":
            case "partlyCloudy":
                codeName = "多云";
                break;
            case "cloudy":
                codeName = "阴天";
                break;
            case "heavyRain":
                codeName = "大雨";
                break;
            case "Drizzle":
            case "sunShowers":
            case "freezingDrizzle":
                codeName = "小雨";
                break;
            case "rain":
                codeName = "雨";
                break;
            case "strongStorms":
            case "scatteredThunderstorms":
            case "isolatedThunderstorms":
                codeName = "雷阵雨";
                break;
            case "flurries":
                codeName = "阵雨";
                break;
            case "freezingRain":
                codeName = "冰雹";
                break;
            case "heavySnow":
                codeName = "大雪";
                break;
            case "snow":
                codeName = "雪";
                break;
            case "sunFlurries":
            case "blowingSnow":
                codeName = "小雪";
                break;
             case "blizzard":
                codeName = "暴风雪";
                break;

        }
        return codeName;
//    	if(weatherType.equals("晴")){
//    		return "晴";
//    	}else if(weatherType.equals("多云")){
//    		return "多云";
//    	}else if(weatherType.equals("阴")){
//    		return "阴";
//    	}else if(weatherType.equals("雨")){
//    		return "雨";
//    	}
    }

}
